import request from "@/utils/request";

export const add = (params) => {
  const { trainCode, index, name, namePinyin, inTime, outTime, km } =
    params;
  return request.post("/system/train-station/add", {
    trainCode,
    index,
    name,
    namePinyin,
    inTime,
    outTime,
    km,
  });
};

export const getPage = (pageNo, pageSize, search) => {
  const { code } = search;
  return request.post("/system/train-station/page", {
    pageNo,
    pageSize,
    code,
  });
};

export const remove = (id) => {
  return request.delete(`/system/train-station/remove/${id}`);
};

export const edit = (params) => {
  const { id, trainCode, index, name, namePinyin, inTime, outTime, km } =
    params;
  return request.post("/system/train-station/edit", {
    id,
    trainCode,
    index,
    name,
    namePinyin,
    inTime,
    outTime,
    km,
  });
};

export const getTrainStation = (params) => {
  const { trainCode, index } = params;
  return request.post("/system/train-station/one", {
    trainCode,
    index,
  });
};
